<template>
  <div>
    <h1>学生管理</h1>
    <img src="../assets/logo.png"/>
    <AddStudent :cutBean="currentCutObj"></AddStudent>
    <ListStudent  :cutBean="currentCutObj" @sp="showStudent" 
    @findById="setObj"></ListStudent>
    <UpdateStudent :updateObj="updateObj"></UpdateStudent>
  </div>
</template>

<script>
import AddStudent  from "./studentManager/AddStudent.vue"
import ListStudent  from "./studentManager/ListStudent.vue"
import UpdateStudent  from "./studentManager/UpdateStudent.vue"
export default {
    components:{AddStudent,ListStudent,UpdateStudent},
    data(){
       return {
          currentCutObj:{},
          updateObj:{},
          cutObj1:{
                total:10,
                pages:2,
                list:[{id:1,name:"刘三",sex:"男",grade:80},
                    {id:5,name:"何江",sex:"男",grade:70},
                    {id:4,name:"胡丽",sex:"女",grade:90},
                    {id:8,name:"吴强",sex:"男",grade:65},
                    {id:3,name:"赵军",sex:"男",grade:76}
                    ]
          },
          cutObj2:{
                total:10,
                pages:2,
                list:[{id:12,name:"周力",sex:"男",grade:76},
                    {id:16,name:"许文",sex:"女",grade:95},
                    {id:11,name:"刘红",sex:"女",grade:85},
                    {id:9,name:"郑武",sex:"男",grade:88},
                    {id:23,name:"王山",sex:"男",grade:63}
                    ]
          },
       }
    },
    methods:{
        speak(info){
          alert("页码："+info);
        },
       showStudent(n){
         if(n == 1){
            this.currentCutObj = this.cutObj1;
         }
         else{
           this.currentCutObj = this.cutObj2;
         }
       },
       setObj(s){
         this.updateObj = s;
       }
    },
    created(){
       this.showStudent(1);
    }
}
</script>

<style>

</style>